package com.javafm;

import com.javafm.util.ApacheHttpUtil;
import com.javafm.util.JdkHttpUtil;
import io.vertx.core.Vertx;
import io.vertx.ext.web.client.WebClient;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

public class App
{
    public static void main( String[] args ) throws Exception {
//        String content = JdkHttpUtil.get("http://www.baidu.com");
//        System.out.println(content);
//
//        String fromData = "page=1&count=5";
//        String content = JdkHttpUtil.post("https://api.apiopen.top/getWangYiNews", fromData.getBytes());
//        System.out.println(content);

//        String content = ApacheHttpUtil.get("http://www.baidu.com");
//        System.out.println(content);

//        String fromData = "page=1&count=5";
//        String content = ApacheHttpUtil.post("https://api.apiopen.top/getWangYiNews", fromData);
//        System.out.println(content);

//        RestTemplate restTemplate = new RestTemplate();
//        String content = restTemplate.getForObject("http://www.baidu.com", String.class);
//        System.out.println(content);


//        HttpHeaders headers = new HttpHeaders();
//        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
//        MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
//        formData.add("page", "1");
//        formData.add("count", "5");
//        HttpEntity<MultiValueMap<String,String>> request = new HttpEntity<>(formData, headers);
//        String content = restTemplate.postForObject("https://api.apiopen.top/getWangYiNews", request, String.class);
//        System.out.println(content);

    }
}
